package com.keymozy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keymozy.mapper.PositionMapper;
import com.keymozy.pojo.Position;
import com.keymozy.pojo.Staff;
import com.keymozy.service.PositionService;
import com.keymozy.util.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
public class IPositionService extends ServiceImpl<PositionMapper, Position> implements PositionService {
    @Override
    public List<Position> getAll() {
        Staff staff = (Staff) TokenUtil.data.get();
        LambdaQueryWrapper<Position> lqw = null;
        if (!"-1".equals(staff.getPosition().getPrivil())){
            lqw = new LambdaQueryWrapper<>();
            lqw.ne(Position::getPrivil,"-1");
        }
        return list(lqw);
    }
}
